<template>
  <view>
    <view class="counselor-img-box">
      <view class="img">
        <img class="lazy" :src="lists.image" :alt="lists.name" />
      </view>

      <view class="txt">
        <ul class="data">
          <li>
            <view class="num">
              <span>{{ lists.clients }}</span>
              <em>人</em>
            </view>
            <p>服务客户</p>
          </li>

          <li>
            <view class="num">
              <span>{{ lists.survey }}</span>
              <em>次</em>
            </view>
            <p>勘察楼盘</p>
          </li>

          <li>
            <view class="num">
              <span>{{ lists.manyi }}</span>
              <!-- <em>%</em> -->
            </view>
            <p>满意度</p>
          </li>
        </ul>
      </view>
    </view>

    <view class="mod counselo-base">
      <view class="mod-bac">
        <view class="btn-area">
          <button class="btn btn-v3 btn-bgimg click_open_layer" @click="open({
								type:'counselor',
								msg:'向他咨询',
								title:'向他咨询',
								item:lists
							})">
            向他咨询
          </button>
        </view>
        <view class="name-wrap">
          <view class="name">
            <h3>{{ lists.name }}</h3>
          </view>
          <view class="college">
            <p>{{ lists.school }}</p>
          </view>
        </view>
        <view class="lb-area-v3">
          <span
            v-for="(item, index) in lists.type_arr"
            :key="index"
            class="new-lbs gray-bg"
            >{{ item }}</span
          >
        </view>

        <view class="txt-con">
          <view class="con">
            {{ lists.description }}
          </view>
        </view>
      </view>
    </view>

    <!-- 服务案例 -->
    <view class="row fwal-v3-md">
      <view class="mod1">
        <view class="hd">
          <h2>服务案例(2)</h2>
        </view>

        <view>
          <view
            class="fwal-wrap"
            v-for="(item, index) in list.slice(0, idxLen)"
            :key="index"
          >
             <view class="item-top">
                            <view class="fwal-tit" >
                                <view class="box"></view>
                                <view class="fwal-tit-img">
                                    <img src="@/static/img00/sir.png" alt="">
                                </view>
                                <h4>{{ item.xq }}</h4>
                            </view>
                            <view class="des">
                                <span class="icon">用户需求</span>
                                <p>{{ item.tjlp }}</p>
                            </view>
                        </view>
                        <view class="item-bottom">
                            <view class="fwal-tit tuijian">
                                <view class="box"></view>
                                <view class="fwal-tit-img">
                                    <img src="@/static/img00/lou.png" alt="">
                                </view>
                                <h4>匹配楼盘推荐</h4>
                            </view>
                            <view class="detail-cont-list">
                                <view class="con-item">
                                    <view class="recommend-list">
                                        <view class="tit">
                                            <p>推荐楼盘 <span>{{ item.reson }}</span> </p>
                                        </view>

                                        <view class="des">
                                            <span class="icon">推荐理由</span>
                                            <p>{{ item.tes }}</p>
                                        </view>
                                        <view class="des">
                                            <span class="icon">推荐指数</span>
                                            <p>
                                                <img src="@/static/img00/score.png" />
                                                <img src="@/static/img00/score.png" />
                                                <img src="@/static/img00/score.png" />
                                            </p>
                                        </view>
                                       
                                        <view class="details">

                                            <view class="details-img">
                                                <!-- <img src="@/static/img00/download0.jpg" alt=""> -->
                                            </view>
                                            
                                            <view class="details-price">
                                                <view class="price single">
                                                    <span>参考单价</span>
                                                    <p>{{ item.price }}元/㎡</p>
                                                </view>

                                                <view class="price area">
                                                    <span>户型面积</span>
                                                    <p>{{ item.size }}</p>
                                                </view>
                                                <view class="price site">
                                                    <span>楼盘地址</span>
                                                    <p>{{ item.qu }}</p>
                                                </view>
                                            </view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>

          </view>


        </view>

        <view @click="getMore()" class="more-v3" id="more_case">
          展开更多服务案例(2)
        </view>

      </view>
    </view>

    <!-- 楼盘 -->
    <view>
	  <recommend :jdata="tui_res"></recommend>
    </view>

    <!-- 服务介绍 -->
    <view>
      <serve ></serve>
    </view>

    <!-- 底部固定框 -->
    <view class="fixed">
      <advisory :pop_three="lists"></advisory>
    </view>
	
	<uni-popup ref="popup" type="center">
	    <view class="pop-content">
	        <view class="pop-zxs-intr-v3">
	            <view @click="close()" class="pop-shut"></view>
	            <view class="pop-zxs-pic">
	                <img :src="lists.image" :alt="lists.name">
	            </view>
	            <view class="pop-zxs-txt">
	                <h5>{{lists.name}}</h5>
	                <p>已为<span>{{lists.clients}}</span>人解答过问题</p>
	            </view>
	            <view class="pop-text">
	                <p class="pop-text-p1">买房政策、房源信息、楼盘分析</p>
	                <p>有问题，他将在第一时间为您解答！ </p>
	            </view>
	             <view class="pop-phone">
	                <input @input="onKeyInput2" :value="mobile" type="pop-text" placeholder="请输入订阅手机号" >
	            </view>
	            <button class="pop-btn-area"  @click="expert">确定</button>
	        </view>
	    </view>   
	</uni-popup> 
	
  </view>
</template>

<script>
import Mess from "./Mess";
import recommend from "../recommend";
import Serve from "pages/index/detail/Serve";
import Advisory from "pages/index/detail/Advisory";
import { getPageCounselorDetail } from "../../../config/api";

import uniPopup from '@/components/uni-popup/uni-popup.vue'
import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
export default {
  components: {
    Mess,
	recommend,
    Serve,
    Advisory,
	uniPopup,
	uniPopupMessage,
	uniPopupDialog,
  },
  onLoad(e) {
    // debugger
    let id = e.id;
	// console.log(id);
    this.$api.getPageCounselorDetail({
    		id:id
    	},
    	res => {
    		this.lists = res.data.lists;
			this.tui_res = res.data.tui_res;
			console.log(res);
    	}
    );
  },
  data() {
    return {
		tui_res:{},
      idxLen: 1,
      list: [
        {
          xq: "唐先生",
          tjlp: "已有购房资格，想在西湖区找到一个100㎡的三居，有哪些楼盘比较适合我呢",
          reson: "锦粼云荟1",
          tes:"户型面积都符合购房需求",
          price:"29600",
          size :"一居、两居 87-125㎡",
          qu:"拱墅区",
        },
        {
          xq: "王先生",
          tjlp: "楼盘222",
          reson: "楼盘好好好33333",
          tes:"户型面积都符合购房需求",
          price:"36300",
          size :"三居 87-125㎡",
          qu:"滨江区",
        },
        {
          xq: "成先生",
          tjlp: "楼盘33333",
          reson: "楼盘好好好3333333",
          tes:"户型面积都符合购房需求",
          price:"54600",
          size :"三居、四居 87-125㎡",
          qu:"西湖区",
        },
      ],
      lists: [
        {
          
        },
      ],
	  mobile:''
    };
  },
  methods: {
	open(data){
			  this.pop_three = data.item;
			  this.param ={
			  	'type': data.type,
			  	'msg': data.msg,
			  };
	    this.$refs.popup.open()
	},
	close(){
	     this.$refs.popup.close()
	},
	
	close1(){
	    this.$refs.message.close()
	},
	onKeyInput2: function(event) {
		this.mobile = event.target.value
	},
	expert(){
		//提交
		let _this = this;
		let mobile = this.mobile;
		if(mobile == ''){
			uni.showToast({
			    title: '手机号码不能为空',
			    duration: 2000,
				icon:'none'
			});
			return false;
		}
		
		var myreg = /^[1][3,4,5,7,8,9][0-9]{9}$/;
		if (!myreg.test(mobile)) {
			uni.showToast({
			    title: '请输入正确的手机号',
			    duration: 2000,
				icon:'none'
			});
			return false;
		}
		this.param.mobile = mobile;
		// this.param.loupan_res = this.info;
			this.param.counselor_id = this.pop_three.id;
		this.$api.pushAjaxSubmit({
				param:_this.param
			},
			res => {
				if(res.code == 1){
					uni.showToast({
						title: res.msg,
						duration: 2000
					});
				}else{
					uni.showToast({
						title: res.msg,
						duration: 2000,
						icon:'none'
					});
				}
				_this.$refs.popup.close()
			}
		);
	},  
	  
    getMore() {
      //list数据长度为请求过来的数据长度
      if (this.idxLen == this.list.length) {
        uni.showToast({
          icon: "none",
          title: "没有更多了",
        });
      } else {
        this.idxLen = this.list.length;
      }
    },
    /* getData() {
    //   debugger;
      let id = 7;
      this.$api.getPageCounselorDetail(
        {
          id: id,
        },
        (res) => {
        //   debugger;
          this.lists = res.data.lists;
          console.log(this.lists);
        }
      );
    }, */
  },
};
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
  list-style: none;
}
.counselor-img-box {
  height: 460upx;
}

.img > img {
  height: 460upx;
}
.txt {
  height: 260upx;
  margin-top: -260upx;
  background: #fff;
}
.data {
  height: 76upx;
  padding-left: 140upx;
  margin-top: 160upx;
}
.data > li {
  width: 120upx;
  height: 76upx;
  float: left;
  position: relative;
  z-index: 99;
  text-align: center;
  color: #fff;
  /* font: 12px Microsoft YaHei, arial, */
  margin: 0 0 0 20upx;
  font-family: DINCondensedBold;
}

.num > span {
  font-size: 34upx;
}
.num > em {
  font-size: 20upx;
  font-style: normal;
  margin-left: 6upx;
}
li > p {
  font-size: 20upx;
}

.fixed {
  height: 114upx;
  width: 760upx;
  background: #fff;
  margin: 0 auto;
  position: fixed;
  bottom: 0;
  z-index: 999;
}

.mod {
  height: 442upx;
  background: #fff;
}
.mod-bac {
  width: 670upx;
  height: 350upx;
  float: left;
  margin-left: 40upx;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}
.college > p {
  color: #77808a;
  font-size: 24upx;
  margin-top: 20upx;
}

.btn-area {
  width: 200upx;
  height: 64upx;
  float: right;
}
.btn {
  width: 200upx;
  height: 64upx;
  background: #13c3c3;
  color: #fff;
  letter-spacing: 2upx;
  border-radius: 4upx;
  font-size: 32upx;
  line-height: 64upx;
}

.name-wrap {
  width: 470upx;
  height: 108upx;
  float: left;
}

.lb-area-v3 {
  width: 670upx;
  height: 36upx;
  float: left;
  font-size: 24upx;
  color: #13c3c3;
  margin-top: 10upx;
}
.lb-area-v3 > span {
  padding: 10upx 10upx 10upx 10upx;
  background: #f3f6f9;
  text-align: center;
  line-height: 36upx;
  margin-right: 20upx;

  border-radius: 10upx;
}

.txt-con {
  height: 176upx;
  width: 670upx;
  float: left;
  background: #f3f6f9 url("../../../static/img00/mm.png") no-repeat 2upx 0;
  border-radius: 10upx;
  margin-top: 20upx;
}
.con {
  height: 120upx;
  width: 622upx;
  background: #f3f6f9;
  margin: 0 auto;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.row {
  background: #fff;
  margin-top: 20upx;
  padding-top: 40upx;
  padding-bottom: 40upx;
}
.mod1 {
  margin: 0 40upx 0 40upx;
}
.hd {
  margin-bottom: 40upx;
}

.more-v3 {
  width: 100%;
  height: 92upx;
  background: #f3f6f9;
  line-height: 92upx;
  text-align: center;
  color: #77808a;
  border-radius: 10upx;
}

.fwal-wrap {
  background: #d0f3f3;
  margin-bottom: 60upx;
  border-radius: 14upx;
  -webkit-filter: drop-shadow(4px 4px 5px rgb(236, 231, 231));
  filter: drop-shadow(4px 4px 5px rgb(236, 231, 231));
  padding: 40upx 30upx;
}
.fwal-tit {
  display: flex;
}
.box {
  height: 50upx;
  width: 8upx;
  border-left: 8upx solid #4bd1d1;
}
.fwal-tit-img {
  height: 50upx;
  width: 50upx;
}
.fwal-tit-img > img {
  width: 100%;
  height: 100%;
  margin-left: 10upx;
}
.fwal-tit > h4 {
  line-height: 50upx;
  margin-left: 20upx;
}
.des {
  margin-top: 20upx;
}
.icon {
  width: 112upx;
  color: #77808a;
  float: left;
}
.des > p {
  width: 490upx;
  margin-left: 140upx;
  letter-spacing: 5upx;
}
.tuijian {
  margin-top: 40upx;
}
.tit {
  margin-top: 20upx;
  color: #77808a;
}
.tit > p > span {
  color: #000;
  font-weight: 550;
  margin-left: 25upx;
}

.details {
  margin-top: 20upx;
  display: flex;
}
.details-img {
  width: 224upx;
  height: 168upx;
  margin-right: 20upx;
}
.details-img > img {
  width: 100%;
  height: 100%;
  border-radius: 10upx;
}
.price {
  display: flex;
  line-height: 50upx;
}
.price > span {
  color: #77808a;
}
.price > p {
  color: #77808a;
  margin-left: 20upx;
}
.single > p {
  color: #fa5f35;
  font-weight: 550;
}
.area > p {
  width: 224upx;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}






.pop-shut{
	    height: 32upx;
	    width: 32upx;
	    position: relative;
	    top:-30upx;
	    left: 560upx;
	    background: url("../../../static/img00/shut.png") no-repeat;
	    background-size: 100% 100%;
	}
	.pop-content{  
	
	    background: #fff;
	    border-radius: 10upx;
	    display: flex;
	} 
	
	.pop-zxs-intr-v3{
	    padding: 50upx 60upx 50upx 60upx;
	    margin: 0 auto;
	
	}
	.pop-zxs-pic{
	    height: 120upx;
	    width: 120upx;  
	    float: left;
	}
	.pop-zxs-pic>img{
	    height: 100%;
	    width: 100%;
	    border-radius: 50%;
	}
	
	.pop-zxs-txt{
	    height: 120upx;
	    margin-left: 140upx;
	    line-height: 60upx;
	   
	}
	.pop-zxs-txt>h5{
	    font-size: 32upx;
	}
	.zxs-txt>p{
	    font-size: 28upx;
	    color: #77808a;
	}
	.pop-zxs-txt>p>span{
	    color: #13c3c3;
	}
	.pop-text{
	    margin-top: 50upx;
	    margin-bottom: 80upx;
	}
	.pop-text>p{
	    width: 500upx;
	    overflow: hidden;
	    text-overflow:ellipsis;
	    white-space: nowrap;
	}
	.pop-text-p1{
	    margin-left: 20upx;
	    margin-right: 40upx;
	}
	.pop-phone{
	    border: 1upx solid #cdd7e1;
	    border-radius: 10upx;
	}
	.pop-phone>input{
	    padding: 0 30upx;
		border: 1px solid #E3E3E3;
	}
	input{
	    height: 86upx;
	}
	.pop-btn-area{
	    margin-top: 80upx;
	    margin-bottom: 30upx;
	    background: #13c3c3;
	    color: #fff;
	}
	.pop-expert2-popup{
	    width: 510upx;
	    height: 240upx;
	    background: #fff;
	    border-radius: 10upx;
	}
	.pop-expert2-popup-p{
	    height: 150upx;
	    text-align: center;
	    font-size: 28uxp;
	    color: #3e4a59;
	    line-height: 150upx;
	    border-bottom: 1upx solid rgb(195, 195, 195);
	}
	.pop-expert2-popup-shut{
	    text-align: center;
	    line-height: 90upx;
	    color: #47b3e3;
	} 






	
	.mod{
	    width: 670upx;
	    margin: 0 auto;
	    /* background: cyan; */
	}
	
	 .hd{
	        padding-top: 52upx;
	        margin-bottom: 30upx;
	    }
	
	    .tit{
	        font-size: 32upx;
	        margin-bottom: 40upx;
	        font-weight: 550;
	    }
	
	    .con>img{
	        /* height: 20.4rem; */
	        width: 670upx;
	    }
</style>